<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/website/layout/tag.jsp"%>
<script type="text/javascript">
	$(document).ready(
		function() {
			//事件注册.
			$("#searchBtn").click(searchUser);
			//"新增"按钮点击事件注册.
			$("#newBtn").click(newUser);
			//"编辑"按钮点击事件注册.
			$("#modifyBtn").click(modifyUser);
			//"删除"按钮点击事件注册.
			$("#deleteBtn").click(deleteUser);
			
			
			//checkbox控件事件注册.
			$("[name='chkAll']").each(
				function() {
					$(this).click(function() {
						checkAll("chkAll", "chkEach");
					});
				}
			);
			$("[name='chkEach']").each(
				function() {
					$(this).click(function() {
						checkEach("chkAll", "chkEach");
					});
				}
			);
			
			//设置左菜单对应菜单CSS为选中状态.
			changeToActiveCss("menu_7010");
			
			//消息显示.
			var msg = '<c:out value="${msg}"/>';
			if (msg != "") {
				alert(msg);
			}
		}
	);
	
	
	
	function searchUser(){
		$("#searchForm").submit();
	}
	
	function newUser() {
		window.location.href='${pageContext.request.contextPath}/system/enterEmployeeModify.action?oper=new';
	}
	
	function modifyUser() {
		var checkObjs = $(":checkbox[name='chkEach']:checked");
		var len = checkObjs.length;
		if (len == 0) {
			alert("请选择要编辑的用户.");
			return false;
		}
		
		if (len > 1) {
			alert("请只选择一条用户.");
			return false;
		}
		
		window.location.href='${pageContext.request.contextPath}/system/enterEmployeeModify.action?oper=modify&sysId=' + checkObjs[0].value;
	}
	
	function deleteUser() {
		var userIds = "";
		$(":checkbox[name='chkEach']:checked").each(
			function() {
				userIds += $(this).val() + ",";
			}
		);
		
		if (userIds == "") {
			alert("请选择要删除的用户。");
			return false;
		}
		
		if (confirm("是否删除用户?")) {
			window.location.href='${pageContext.request.contextPath}/system/deleteUser.do?userIds=' + userIds;
		}
	}
</script>
<div id="content_right">
	<div style="width:100%;height:35px;line-height:35px;text-align:left;background-color:#F5FAFA;font-weight:bold; ">系统管理 > 管理员 > 管理员列表</div>
	<div id="searchArea">
		<form id="searchForm" action="${pageContext.request.contextPath}/system/searchEmployeeList.action" >
		<table width="100%" cellspacing="0">
			<tr>
				<td width="80px" align="right">用户ID:</td>
				<td width="120px" align="left">
					<input type="text" name="id" style="width:120px;" maxlength="30" value="${id}"/>
				</td>
				<td width="70px" align="right">账户名:</td>
				<td width="120px" align="left">
					<input type="text"  name="loginName" style="width:120px;" maxlength="8" value="${loginName}"/>
				</td>
				<td width="80px" align="right">角色名:</td>
				<td width="120px" align="left">
					<select id="rules" name="ruleId" style="width:200px; ">
					  <option value="">请选择角色名 </option>
					  <c:if test="${not empty ruleList}">
						  <c:forEach items="${ruleList}" var="item" varStatus="status">
						  		<option value="${item.itemValue}" >${item.itemLabel}</option>
						  </c:forEach>
					  </c:if>
					</select>
				</td>
				<td></td>
			</tr>
			<tr>
				<td align="right">账户注册时间:</td>
				<td align="left" colspan="3">
					<input type="text" id="accountExpiredGTTime" name="accountExpiredGTTime" style="width:80px"  onclick=" WdatePicker({maxDate:'#F{$dp.$D(\'accountExpiredLTTime\')}'})" jwcid="E0252" value="${accountExpiredGTTime }"/>
					&nbsp;-&nbsp;
					<input type="text" id="accountExpiredLTTime" name="accountExpiredLTTime" style="width:80px"  onclick=" WdatePicker({minDate:'#F{$dp.$D(\'accountExpiredGTTime\')}'})" jwcid="E0252" value="${accountExpiredLTTime }"/>
					&nbsp;(YYYYMMDD)
				</td>
				<td align="right">证书开始时间:</td>
				<td align="left" colspan="3">
					<input type="text" id="credentialsExpiredGTTime" name="credentialsExpiredGTTime" style="width:80px"  onclick="WdatePicker({maxDate:'#F{$dp.$D(\'credentialsExpiredLTTime\')}'})" jwcid="E0252" value="${credentialsExpiredGTTime }"/>
					&nbsp;-&nbsp;
					<input type="text" id="credentialsExpiredLTTime" name="credentialsExpiredLTTime" style="width:80px"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'credentialsExpiredGTTime\')}'})" jwcid="E0252" value="${credentialsExpiredLTTime }"/>
					&nbsp;(YYYYMMDD)
				</td>
			</tr>
			<tr>
				<td align="right">是否超级用户:</td>
				<td align="left">
					<input type="checkbox" name="isSys" value="1"/>
				</td>
				<td align="right">是否黑名单:</td>
				<td align="left">
					<input type="checkbox" name="enable" value="1"/>
				</td>
				<td align="right">是否被锁:</td>
				<td align="left">
					<input type="checkbox" name="isAccountLocked" value="1"/>
				</td>
			</tr>
			<tr>
				<td colspan="9">
					<div class="buttons" style="float:right; margin-right:40px;">
						<a id="searchBtn" href="#">
							<img src="../images/btn_search.gif" alt=""/> 
							检索
						</a>
					</div>
				</td>
			</tr>
		</table>
		</form>
	</div>
	<div id="btnArea">
		<div class="buttons">
			<a id="newBtn" href="#">
				<img src="../images/btn_apply.png" alt=""/> 
				新增
			</a>
			<a id="modifyBtn" href="#">
				<img src="../images/btn_apply.png" alt=""/> 
				编辑
			</a>
			<a id="deleteBtn" href="#">
				<img src="../images/btn_cross.png" alt=""/> 
				删除
			</a>
		</div>
	</div>
	<div style="clear:both; "></div>
	
	<div id="resultArea" style="height:500px; ">
		<table class="dataTable" cellspacing="0"> 
			<tr> 
			<th scope="col" width="26px;"><input type="checkbox" name="chkAll"/></th> 
			<th scope="col" width="90px">用户名</th> 
			<th scope="col" width="100px">用户姓名</th> 
			<th scope="col" width="140px">用户类型</th> 
			<th scope="col" width="80px">编号</th> 
			<th scope="col" width="140px">最后登陆时间</th> 
			<th scope="col" width="140px">最后登陆IP</th> 
			<th scope="col" width="60px">状态</th>
			<th scope="col" ></th>
			</tr> 
			<c:if test="${not empty pageBean.resultSetList}">
				 
				<c:forEach var="user" items="${pageBean.resultSetList}" varStatus="status">
				<tr>
					<td class="row"> <input type="checkbox" name="chkEach" value="${user.id}"/></td>
					<td class="row">${user.loginName}</td> 
					<td class="row">${user.information.name}</td> 
					<td class="row">&nbsp;</td> 
					<td class="row">&nbsp;</td>
					<td class="row">&nbsp;</td>
					<td class="row">&nbsp;</td>
					<td class="row">&nbsp;</td>
				</tr> 
				</c:forEach>
				
			</c:if>
		</table> 
		<c:if test="${not empty pageBean.resultSetList}">
			<jsp:include page="/website/layout/mickPage.jsp"></jsp:include>
		</c:if>
	</div>
</div>

